<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
          /*
            *
            **
            ***
            ****
            *****

                 *
                **
               ***
              ****
             *****
        */
        /* 
            1111*
            111**
            11***
            1****
            *****
            11111
            1111
            111
            11
            1
            *
            **
            ***
            ****
            *****
        */
        /* 
             i           j
             0           5
             1           4
             2           3
             3           2
             4           1
             i + j = 5;
             j = 5 - i;
 
             i           j
             0           1
             1           2
             2           3
 
             i + 1 = j
        */

        for(let i=0;i<5;i++){
            let a='';
            let b='';
            for(let j=0;j<5-i;j++){
                a=a+'';
            }
            for(let j=0;j<i+1;j++){
                b=b+'*';
            }
            console.log(a+b);
        }
        
    </script>
</body>
</html>